/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package classes;

import java.io.UnsupportedEncodingException;

/**
 *
 * @author user
 */
public class Util 
{
    public static String workArroundBoolean(String value)
    {
        if( value == null || value.equals("null"))
            return "false";
        if( value.equals("S") || value.equals("Sim") || value.equals("s") || value.equals("sim"))
            return "true";
        return "false";
    }

    public static String workArroundUtf8ToUnicode(String value)
    {
        String aux;
        if( value == null || value.equals("null"))
            return "";        
        
        value = value.replace('\"', ' ');
        value= value.replace('\'', ' ');
        try {
            // Convert from UTF-8 to Unicode
            aux = new String(value.getBytes(), "latin1");
        } 
        catch (UnsupportedEncodingException e) {
            aux= value;
        }        
        return aux;
    }

    public static Boolean soLetras(String str)
    {
       for(int i=0; i < str.length(); i++)
          if( !Character.isLetter(str.charAt(i)))
             return false;
       return true;
    }
}
